com.highdeal.admin.hci
Class InstanceId

java.lang.Object
  extended by com.highdeal.admin.hci.InstanceId
All Implemented Interfaces:
java.lang.Comparable<InstanceId>

public final class InstanceId
extends java.lang.Object
implements java.lang.Comparable<InstanceId>

This Java class represents a classification for the instances in a deployed SAP CC Core Server system; This classification identifies a system instance by an instance type associated to a number that identifies the instances of the same type. This number is positive and not null and is defined at installation time.

Examples

Note

This classification is defined for an SAP CC system. If your system landscape includes two SAP CC systems, two instances may have the same identifier, but belonging to different SAP CC systems. For example dispatcher#1 and rater#1 are present on both SAP CC systems.

See Also:
InstanceType, InstanceMap

Field Summary
static char SEPARATOR
          The string representation of the separator used in the syntax of an instance ID: '#' Refer to the marshal() and unmarshal() methods
static InstanceId UPDATER_ID
          Instance ID of the updater instance of the SAP CC system
 
Method Summary
 int compareTo(InstanceId other)
           
 boolean equals(java.lang.Object obj)
           
static InstanceId getInstanceId(InstanceType instanceType, int instanceNum)
          Returns an InstanceId object built from the specified instance type and a positive number
 int getInstanceNum()
          Returns the number of an instance with the same type.
 InstanceType getInstanceType()
          Returns the instance type of the current instance ID.
 int hashCode()
           
static java.lang.String marshal(InstanceId instanceId)
          Marshals the InstanceId object into a string; The string result has the following syntax: <INSTANCE_TYPE>SEPARATOR<NUMBER>
static void marshal(InstanceId instanceId, com.highdeal.hmi.DataBuffer buffer)
          Marshals the InstanceId object into the specified data buffer.
 java.lang.String toString()
           
static InstanceId unmarshal(com.highdeal.hmi.IDataBuffer buffer)
          Extracts an InstanceId object from the data buffer specified as argument.
static InstanceId unmarshal(java.lang.String instanceId)
          Unmarshals the string representation of an instance ID into an InstanceId object; The string argument have to respect the following grammar: <INSTANCE_TYPE>SEPARATOR<NUMBER>
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final char SEPARATOR
The string representation of the separator used in the syntax of an instance ID: '#' Refer to the marshal() and unmarshal() methods

See Also:
Constant Field Values

UPDATER_ID

public static final InstanceId UPDATER_ID
Instance ID of the updater instance of the SAP CC system

Method Detail

getInstanceType

public InstanceType getInstanceType()
Returns the instance type of the current instance ID.

Returns:
The instance type

getInstanceNum

public int getInstanceNum()
Returns the number of an instance with the same type.

Returns:
The number of instance

compareTo

public int compareTo(InstanceId other)
Specified by:
compareTo in interface java.lang.Comparable<InstanceId>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

marshal

public static final java.lang.String marshal(InstanceId instanceId)
                                      throws java.lang.IllegalArgumentException
Marshals the InstanceId object into a string; The string result has the following syntax: <INSTANCE_TYPE>SEPARATOR<NUMBER>

Parameters:
instanceId - The instanceId to marshal
Returns:
The string representation of the instanceId given in argument
Throws:
java.lang.IllegalArgumentException - when the argument is null

unmarshal

public static final InstanceId unmarshal(java.lang.String instanceId)
                                  throws java.lang.IllegalArgumentException,
                                         java.lang.NumberFormatException
Unmarshals the string representation of an instance ID into an InstanceId object; The string argument have to respect the following grammar: <INSTANCE_TYPE>SEPARATOR<NUMBER>

Parameters:
instanceId - The result instanceId object
Returns:
The instance identifier corresponding to the argument
Throws:
java.lang.IllegalArgumentException - When the string argument does not respect the format or is null
java.lang.NumberFormatException - When the second part of the string is not a positive number

marshal

public static final void marshal(InstanceId instanceId,
                                 com.highdeal.hmi.DataBuffer buffer)
                          throws java.lang.IllegalArgumentException,
                                 java.nio.BufferOverflowException
Marshals the InstanceId object into the specified data buffer.

Parameters:
instanceId -
buffer - The result data buffer
Throws:
java.lang.IllegalArgumentException - When one is null
java.nio.BufferOverflowException - If the buffer has not at least six bytes free

unmarshal

public static final InstanceId unmarshal(com.highdeal.hmi.IDataBuffer buffer)
                                  throws java.lang.IllegalArgumentException,
                                         java.nio.BufferUnderflowException
Extracts an InstanceId object from the data buffer specified as argument.

Parameters:
buffer - The input data buffer
Returns:
The InstanceId object extracted from the buffer
Throws:
java.lang.IllegalArgumentException - When the data buffer is null
java.nio.BufferUnderflowException - If the buffer has not at least six bytes remaining

getInstanceId

public static final InstanceId getInstanceId(InstanceType instanceType,
                                             int instanceNum)
                                      throws java.lang.IllegalArgumentException
Returns an InstanceId object built from the specified instance type and a positive number

Parameters:
instanceType - From the InstanceType
instanceNum - A positive number
Returns:
The InstanceId object built
Throws:
java.lang.IllegalArgumentException - When the instanceType is null or instanceNum is not positive and not null

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)